package com.wyiot.pet.model.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.wyiot.core.enums.MessageTypeEnum;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.apache.ibatis.type.Alias;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 用戶消息实体类
 *
 * @author yly
 * @since 2022年04月08日
 */
@Data
@TableName("user_message")
@Alias("userMessage")
@AllArgsConstructor
@NoArgsConstructor
public class UserMessageDO {
    @TableId(type = IdType.AUTO)
    private Long userMassageId;
    /**
     * 用户id
     */
    private Long userId;
    /**
     * 用戶账号
     */
    private String userCode;
    /**
     * 订单号
     */
    private String orderNumber;
    /**
     * 是否为工作人员的消息
     */
    private boolean ifWorker;
    /**
     * 消息类型
     */
    private MessageTypeEnum messageType;
    /**
     * 预计到达时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
    private Date expectedDeliveryTime;
    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createTime;

    public UserMessageDO(Long userId,String userCode, String orderNumber, boolean ifWorker
            , MessageTypeEnum messageType, Date expectedDeliveryTime
    ) {
        this.userId = userId;
        this.userCode= userCode;
        this.orderNumber = orderNumber;
        this.ifWorker = ifWorker;
        this.messageType = messageType;
        this.expectedDeliveryTime = expectedDeliveryTime;
    }

    public UserMessageDO(Long userId, String orderNumber, boolean ifWorker, MessageTypeEnum messageType) {
        this.userId = userId;
        this.orderNumber = orderNumber;
        this.ifWorker = ifWorker;
        this.messageType = messageType;
    }
}
